<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	
	<img src="https://images2017.cnblogs.com/blog/1206202/201711/1206202-20171104204359670-1159434907.png" alt="">

	<script>
	var url = document.querySelector("img").src;
	console.log(url)
	var xhr = new XMLHttpRequest();
	var img = document.createElement("img")
	var imgdata
	xhr.onreadystatechange = function(){
		if(xhr.readyState === 4&& xhr.status === 200){
			imgdata = xhr.response;
			console.log(imgdata)

			var reader = new FileReader();
			reader.readAsDataURL(imgdata);
			reader.onload = function(){
				img.src= this.result
				document.body.appendChild(img)
				// document.querySelector("#J_testImgBase64").value = this.result
				console.log(img)
				localStorage.setItem("gsFiles", img.src);
			}

		}
	}
	xhr.open("GET",url,true);
	xhr.responseType = "blob"
	xhr.send(null)
	</script>
</body>
</html>
